package sandbox.vaadin.skiller.entity;

import java.io.Serializable;
import java.lang.Long;
import java.lang.String;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: JPASkillgroup
 */
@Entity
@NamedQueries
(
		{
		    @NamedQuery(name = "Skillgroup_select_all", query = "select s from Skillgroup s"),
		    @NamedQuery(name = "Skillgroup_delete_all", query = "delete from Skillgroup"),
		    @NamedQuery(name = "Skillgroup_by_name", query = "select s from Skillgroup s where s.name = :name"),
		    @NamedQuery(name = "Skillgroup_select_roots", query = "select s from Skillgroup s where s.parent = null"),
		    @NamedQuery(name = "Skillgroup_select_children", query = "select s from Skillgroup s where s.parent = :parent")
	  }
)
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }) })
public class Skillgroup implements Serializable
{
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Column(nullable = false)
	private String name;

	@ManyToOne
	private Skillgroup parent;

	private static final long serialVersionUID = 1L;

	public Skillgroup()
	{
		super();
	}

	public Skillgroup(String name)
	{
		this();
		this.name = name;
	}

	public Long getId()
	{
		return id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public Skillgroup getParent()
	{
		return parent;
	}

	public void setParent(Skillgroup parent)
	{
		this.parent = parent;
	}
}